package com.example.administrator.wallet.view.activity;

import android.os.Handler;
import android.widget.ImageView;

import com.blankj.utilcode.util.ActivityUtils;
import com.example.administrator.wallet.R;
import com.example.administrator.wallet.base.BaseActivity;
import com.example.administrator.wallet.utils.SharedPrefsUtil;

import butterknife.Bind;

/**
 * Effect:  App Start
 * <p>
 * Author:  CaiYapeng
 * <p>
 * Time  :  2018/7/4.
 */

public class SplashActivity extends BaseActivity {
    private static final int SHOW_TIME_MIN = 3000;
    private Handler handler = new Handler();
    @Bind(R.id.lauch_screen)
    ImageView lauchScreen;
    private Runnable run = new Runnable() {
        @Override
        public void run() {
            startActive();
            finish();
        }
    };

    @Override
    public void init() {

        initTask();
    }


    private void initTask() {
        handler.postDelayed(run, SHOW_TIME_MIN);
    }

    @Override
    public int getLayoutResource() {
        return R.layout.activity_splash;
    }

    private void startActive(){
        if (SharedPrefsUtil.getValue(this,"wallet","count",1)==3) {
            ActivityUtils.startActivity(SplashActivity.this, FirstPswActivity.class);
        } else {
            ActivityUtils.startActivity(SplashActivity.this, PromptActivity.class);
        }
    }
}
